package com.example.barcodeapp.ui.own.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.appcompat.widget.Toolbar;
import androidx.cardview.widget.CardView;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.bumptech.glide.Glide;
import com.example.barcodeapp.R;
import com.example.barcodeapp.adapter.YouHuiJunAdapter;
import com.example.barcodeapp.base.BaseActivity;
import com.example.barcodeapp.interfaces.IBasePersenter;

import java.util.ArrayList;

import butterknife.BindView;
import butterknife.ButterKnife;

public class ZhiFuActivity extends BaseActivity {

    @BindView(R.id.iv_back_circle)
    ImageView ivBackCircle;
    @BindView(R.id.ff_back_contener)
    FrameLayout ffBackContener;
    @BindView(R.id.iv_back)
    ImageView ivBack;
    @BindView(R.id.tv_location)
    TextView tvLocation;
    @BindView(R.id.tv_title)
    TextView tvTitle;
    @BindView(R.id.ll_to_search)
    LinearLayout llToSearch;
    @BindView(R.id.right_iv)
    ImageView rightIv;
    @BindView(R.id.right_iv_two)
    ImageView rightIvTwo;
    @BindView(R.id.tv_rught_)
    TextView tvRught;
    @BindView(R.id.tv_right_two)
    TextView tvRightTwo;
    @BindView(R.id.toolBar)
    Toolbar toolBar;
    @BindView(R.id.linearLayout4)
    LinearLayout linearLayout4;
    @BindView(R.id.imageView9)
    ImageView imageView9;
    @BindView(R.id.textView27)
    TextView textView27;
    @BindView(R.id.textView28)
    TextView textView28;
    @BindView(R.id.textView29)
    TextView textView29;
    @BindView(R.id.cardView)
    CardView cardView;
    @BindView(R.id.imageView10)
    ImageView imageView10;
    @BindView(R.id.textView30)
    TextView textView30;
    @BindView(R.id.youhuijuanzhuangtai)
    ImageView youhuijuanzhuangtai;
    @BindView(R.id.constraintLayout3)
    ConstraintLayout constraintLayout3;
    @BindView(R.id.youhuijuanneirong)
    RecyclerView youhuijuanneirong;
    @BindView(R.id.textView31)
    TextView textView31;
    @BindView(R.id.textView32)
    TextView textView32;
    @BindView(R.id.zhifuqueren)
    TextView zhifuqueren;

    @Override
    protected int getLayout() {
        return R.layout.activity_zhi_fu;
    }

    @Override
    protected void initView() {

        setToolBar(true, false, true, false, false);
        setTitle("确认订单", R.color.black, R.color.white);
        youhuijuanzhuangtai.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                // 优惠券的显示和隐藏
                if (youhuijuanneirong.getVisibility() == View.VISIBLE) {
                    youhuijuanneirong.setVisibility(View.GONE);
                    Glide.with(ZhiFuActivity.this).load(R.drawable.zhuangtai).into(youhuijuanzhuangtai);
                } else {
                    youhuijuanneirong.setVisibility(View.VISIBLE);
                    Glide.with(ZhiFuActivity.this).load(R.drawable.zhuantai2).into(youhuijuanzhuangtai);
                }
            }
        });


        youhuijuanneirong.setLayoutManager(new LinearLayoutManager(this));
        ArrayList<Boolean> booleans = new ArrayList<>();
        booleans.add(false);
        booleans.add(false);
        YouHuiJunAdapter youHuiJunAdapter = new YouHuiJunAdapter(this, booleans);
        youhuijuanneirong.setAdapter(youHuiJunAdapter);
        youHuiJunAdapter.setClick(new YouHuiJunAdapter.IClick() {
            @Override
            public void click(int pos) {
                for (int i = 0; i < booleans.size(); i++) {
                    booleans.set(i, false);
                }
                booleans.set(pos, true);
                youHuiJunAdapter.notifyDataSetChanged();
            }
        });
        zhifuqueren.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent instant = new Intent(ZhiFuActivity.this, QueRenActivity.class);
//            instant.putExtra("data","系列课程");
                startActivity(instant);
            }
        });
    }

    @Override
    protected IBasePersenter initPersenter() {
        return null;
    }

    @Override
    protected void initData() {

    }


}